<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/commons/jsp-head.jsp" %>
#!/bin/sh
#
#Author:
#Date:
#Description:
#depend:
#create:${table}

source /etc/profile
export LC_ALL=C
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"../utils/DBUtil.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"../utils/log.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"../utils/constant.sh

function createTable()
{
	sql="drop table if exists <%="${table}"%>;
	create table <%="${table}"%>(<c:forEach items="${columns}" var="item">
	${item.field} ${item.type} <c:if test="${item.type=='int'}">default 0</c:if><c:if test="${item.type=='varchart'}">default ''</c:if>,</c:forEach>
	primary key (${keyStr})
	)"
	f_execute_sql "$sql"
}
<c:forEach items="${columns}" var="item">
	<c:if test="${item.key=='false'}">
function ${item.field}()
{
	sql="${item.sql}"
	
	f_insert_column "<%="${sql}"%>" "<%="${table}"%>" ${keyStr2} "${item.field}"
}
	</c:if>
</c:forEach>

function main()
{
  log_start $0

  f_init "$1" "$0"
  
  constant "$1"

  ### 业务 ###
  table="${table}"
  <c:forEach items="${columns}" var="item">
	<c:if test="${item.key=='false'}">
	log_method "${item.field}" 
	${item.field}
	</c:if>
  </c:forEach>
  ### 业务 ###
  
  f_end

  log_end $0
}

main "$1"